package com.yinpeng.app.repository;

import com.yinpeng.app.domain.Note;
import org.springframework.stereotype.Repository;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;

/**
 * Note数据层实现
 */
@Repository
public class JpaNoteRepository implements NoteRepository {

    @PersistenceContext
    private EntityManager entityManager;

    @Override
    public List<Note> findAll(){
        return this.entityManager.createQuery("SELECT n FROM Note n", Note.class).getResultList();
    }
}
